package org.kalai.unifypay.util;

import java.io.StringWriter;

import org.dom4j.Document;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class StringUtil {
	public static boolean isEmpty(Object ... objs){
		for (Object obj : objs) {
			if (obj == null)return true;
			if ("".equals(obj.toString().trim()))return true;
		}
		return false;
	}
	
	public static String xmlToStr(Document doc) {
		try {
			OutputFormat format = OutputFormat.createPrettyPrint();
			format.setEncoding("UTF-8");
			format.setIndent(false);
			format.setNewlines(false);
			format.setNewLineAfterDeclaration(false);
			StringWriter out = new StringWriter();
			XMLWriter writer = new XMLWriter(out, format);
			writer.write(doc);
			writer.close();
			return out.toString();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
	public static boolean isNotEmpty(Object ... objs){
       return !isEmpty(objs);
   }
}
